CDS 6334 - Visual Image Processing

Lecture 4: Edge Detection

1. What Makes an Edge?

An edge is a location where there is a sudden change (discontinuity) in image intensity.
Most shape and object information in an image is contained within its edges.
🧠 Memory Trick:

Edge = Rapid Intensity Change

2. Goal of Edge Detection

Convert an image from a 2D pixel array into a collection of meaningful curves, contours, or line segments.
Main Idea: Detect strong gradients and post-process them into edges.
Exam Keyword:
Intensity Discontinuity

3. Derivatives and Edges

Edges occur where image intensity changes rapidly. Derivatives measure the rate of change.
Large derivative values indicate possible edge locations.
🧠 Remember:
High Derivative = Strong Edge

4. Partial Derivatives

Images have derivatives in both horizontal (x) and vertical (y) directions.
Finite differences are used to approximate derivatives in digital images.
Important:
Derivatives can be implemented using convolution filters.

5. Image Gradient

The gradient combines horizontal and vertical derivatives.
Strong edges produce large gradient magnitudes.

6. Effects of Noise

Noise creates false intensity changes that can be mistaken for edges.
Gradient operators respond strongly to noise.
Solution:
Smooth the image before detecting edges.

7. Derivative of Gaussian

Combine smoothing and differentiation into a single operation.
Because convolution is associative, smoothing and derivative operations can be merged.
🧠 Benefit:
Less computation, less noise sensitivity.

8. First-Order Gradient Filters

First derivatives produce large responses along edge regions.
Edge responses often appear as thick ridges rather than thin lines.

9. Laplacian of Gaussian (LoG)

Uses the second derivative of the Gaussian function.
Edges are detected at zero-crossings of the filter response.
Also Known As:
Marr-Hildreth Edge Detector
🧠 Remember:
LoG → Zero Crossing Detection

10. Difference of Gaussians (DoG)

Approximation of LoG using two Gaussian blurred images.
DoG = Gaussian(σ₁) − Gaussian(σ₂)
Faster than computing the full LoG filter.

11. Effect of Sigma (σ)

σ Value Result
Small σ Detects fine details and noise
Large σ Detects only major edges
🧠 Sigma Rule:
Larger σ → More smoothing → Fewer edges

12. Finite Difference Filters

Approximate image gradients using small convolution masks.
Common edge operators are based on finite differences.

13. Mask Properties

Smoothing Masks Derivative Masks
Positive values Positive and negative values
Weights sum to 1 Weights sum to 0
Preserve constant regions No response in constant regions
Exam Answer:
Derivative Mask Sum = 0

14. Designing an Edge Detector

An optimal edge detector should:
🧠 Remember:
Detect, Locate, Respond Once

15. Thresholding

Separate edge pixels from non-edge pixels using a threshold value.
Pixel ≥ t → 1
Pixel < t → 0
Threshold selection strongly affects edge quality.

16. Choosing a Threshold

Different threshold values produce different edge maps.
Threshold Effect
Low More edges, more noise
High Less noise, possible missing edges
Exam Answer:
High threshold may miss real edges.

17. Canny Edge Detector

The most widely used edge detector because it is stable and consistent.
Three Main Steps:
  1. Gaussian Smoothing + Gradient Computation
  2. Non-Maximum Suppression
  3. Hysteresis Thresholding & Edge Linking

18. Step 1: Gaussian Filtering

Smooth image and compute gradient magnitude and orientation.
Derivative of Gaussian filters can perform both operations together.

19. Step 2: Non-Maximum Suppression

Removes thick edge responses by keeping only local maxima.
Produces thin, one-pixel-wide edges.
🧠 Goal:
Thick Ridge → Thin Edge

20. Step 3: Hysteresis Thresholding

Uses two thresholds instead of one.
Threshold Meaning
High Threshold Strong edges
Low Threshold Weak edges
Weak edges connected to strong edges are preserved.

21. Edge Linking

Connect weak edges to strong edges using 8-neighbourhood searching.
Noise responses are usually isolated and therefore removed.
🧠 Remember:
Strong Edges Guide Weak Edges

22. Effect of Sigma in Canny

σ Result
Small Many fine edges
Large Only major edges

23. Knowing True Edges

Not all detected edges correspond to meaningful object boundaries.
Human perception is often used as ground truth for evaluating edge detectors.

24. Human Segmentation vs Edge Detection

Human-labelled boundaries are compared against detector outputs.
Evaluation Metrics:
Precision = Correct detected edges / Total detected edges
Recall = Correct detected edges / Total true edges

25. Modern Edge Detection

Machine learning and deep learning can learn edge patterns directly from data.
Modern methods outperform traditional hand-crafted edge filters.

26. Final Exam Summary

Most Important Points

  • Edge: Sudden intensity change.
  • Gradient: Measures intensity change.
  • Gradient Magnitude: Edge strength.
  • Noise: Causes false edge responses.
  • Derivative of Gaussian: Smooth + Differentiate.
  • LoG: Detect edges using zero crossings.
  • DoG: Fast approximation of LoG.
  • Sigma: Controls smoothing scale.
  • Thresholding: Separate edges from background.
  • Canny: Gaussian → Non-Max Suppression → Hysteresis.
  • Non-Maximum Suppression: Produces thin edges.
  • Hysteresis: Uses low and high thresholds.
  • Edge Linking: Strong edges guide weak edges.
  • Precision & Recall: Evaluate edge quality.